{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Load Data**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "df = pd.read_csv('C:/Users/irene/Dropbox/! RENEWABLE ENERGY/DATA/final_la_haute_R0711.csv')\n",
    "df['Date'] = pd.to_datetime(df['Date_time'])\n",
    "df['Year'] = df['Date'].dt.year \n",
    "df['Month'] = df['Date'].dt.month \n",
    "new_data=df[['Month','Year','Date','P_avg']]\n",
    "new_data=new_data[new_data.Year == 2017]\n",
    "\n",
    "cap=max(new_data['P_avg'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Parameter Settings**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "i=[1,2] #for fold-1\n",
    "look_back=6\n",
    "data_partition=0.5257331291956189"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "from myfunctions_france import svr_model,ann_model,rf_model,lstm_model,emd_lstm,eemd_lstm,ceemdan_lstm,proposed_method"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "CUDA_VISIBLE_DEVICES=\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 0    4.864697\n",
      "RMSE 137.59350570150775\n",
      "MAE 99.75935953908431\n"
     ]
    }
   ],
   "source": [
    "svr_model(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 4.055859245437509\n",
      "RMSE 134.50685647815283\n",
      "MAE 83.17269031847867\n"
     ]
    }
   ],
   "source": [
    "ann_model(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 0    4.736453\n",
      "RMSE 140.36085835492244\n",
      "MAE 97.12949824261777\n"
     ]
    }
   ],
   "source": [
    "rf_model(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 3.9256132507361365\n",
      "RMSE 130.29165471013505\n",
      "MAE 80.50176188458256\n"
     ]
    }
   ],
   "source": [
    "lstm_model(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 0    1.94388\n",
      "RMSE 67.46651147235622\n",
      "MAE 39.862747462799746\n"
     ]
    }
   ],
   "source": [
    "emd_lstm(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 0    1.884101\n",
      "RMSE 63.98275694147705\n",
      "MAE 38.6368842854692\n"
     ]
    }
   ],
   "source": [
    "eemd_lstm(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 0    1.778186\n",
      "RMSE 66.06711443939713\n",
      "MAE 36.464907324218856\n"
     ]
    }
   ],
   "source": [
    "ceemdan_lstm(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 0    1.505117\n",
      "RMSE 53.82322340798315\n",
      "MAE 30.865125192817963\n"
     ]
    }
   ],
   "source": [
    "proposed_method(new_data,i,look_back,data_partition,cap)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
